package com.itstyle.zmlife.controller;

import com.itstyle.zmlife.utils.QiniuCloudUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.tomcat.util.http.fileupload.disk.DiskFileItem;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
@Api(tags ="七牛云")
@Controller
public class QiniuController {
    @ApiOperation(value = "七牛上传图片")
    @ResponseBody
    @PostMapping("/qiniuUpload")
    public String qiniuUpload(HttpServletRequest request, HttpServletResponse response, @RequestParam("imagefile") MultipartFile multipartFile) {
        return QiniuCloudUtil.insUpLoad(multipartFile);
    }
}
